Repository navigation
Conversation
This reverts commit 8a23cd3.
|
I've been using this PR inside https://github.com/zblanco/runic for some time now as a way to keep causal runtime edges produced during DAG executions from increasing the dataflow traversal costs. It hasn't need changes and tests pass for 1.18 and might be worth reviewing. I developed this locally on Elixir 1.18+ which entailed some changes to doctests related to ordering of some results but this leaves older versions broken in CI. Not 100% on a preferred course of action - I would rather find a way to keep older versions compatible so that's what I'm looking into now. This test discrepancy may be related to OTP updates as it's not related to the actual changes. |
|
The library I've been building that depends on this PR's multigraph functionality: https://github.com/zblanco/runic is about ready to be released on Hex with some other libraries on top of that also looking to be released. Latest commits should add multigraph interaction to the rest of graph mutations and traversal / pathfinding. There are some included benchmarks that show space / time trade offs at different graph sizes with the adjacency index. I also benchmarked this PR against
The original changes I made had edge metadata changed to
Only really matters when multigraphs are actually needed with varying kinds of edges. My use case required workflow runtime memory stored as edges so this prevents dataflow traversal costs from growing with long running workflows. This includes some minor test changes to get CI passing across the Elixir/OTP versions that broke some list comparison ordering in doc tests and charlist representations but it might be worth just dropping older version support and keeping the doctests clean. @bitwalker let me know if you want any changes and/or need time to review - we can point repos at a temporary fork if needed. |
Adds opt-in partition indexes and edge properties for #18 and #54. Graphs already distinguish parallel edges by label;
Graph.new(multigraph: true)adds an index so selected edge kinds can be queried without scanning unrelated neighbors.API and storage
partition_byreceives an edge and returns a list of keys, defaulting tofn edge -> [edge.label] end. For example:Graph.new(multigraph: true, partition_by: fn edge -> [edge.weight] end).by:(one partition or a list) andwhere:(an edge predicate). BFS, DFS, Dijkstra, A*, and Bellman-Ford support partition filtering.%{partition => %{vertex_id => MapSet.t(edge_key)}}. Incident queries begin with the selected endpoint's indexed candidates; relabeling and deletion update affected memberships while retaining partitions shared by parallel labels.%{label => weight}records remain unchanged. Optional properties live separately inGraph.edge_propertiesand are exposed as%Graph.Edge{properties: %{}}.Reconciliation with upstream
Merged upstream
mainat0215768and ported the implementation improvements from the multigraph fork at5ede725, retaining theGraphnamespace and:libgraphpackage. Fork release configuration, renamed modules, development-server dependencies, and generated artifacts are excluded. Upstream CI, dependency lock, package metadata, and minimum Elixir requirement are retained.The integration combines upstream's incident-local vertex mutations, exact numeric identity, custom-identifier pathfinding/subgraphs, self-loop handling, traversal, serialization, and documentation fixes with the fork's partition-local queries and mutation optimizations. Regression tests additionally cover:
Validation
Local validation of integration commit
772ea9e(followed bya2297aa, which removes an unreachable clause flagged by Elixir 1.20):0215768.a2297aa: Elixir/OTP 1.10/23, 1.13/24, 1.16/26, 1.18/27, and 1.20/29; formatting, compile, Dialyzer, documentation, and package checks; and workflow security. BEAM matrix and quality run, workflow security run.The included
bench/partition_indexes.exswas also run sequentially against old PR head3228065and integration commit772ea9eon Elixir 1.19.5 / OTP 28.5, with four schedulers, sizes 128/512/2048, and three measured trials. At 2,048 history entries (6,146 total edges), median times were:These are synthetic workload measurements with fixed selected degree, not general application performance claims. Raw measurements remain outside the repository.